/*      */ package com.qmsk.business.member.custMember.controller;
/*      */ 
/*      */ import com.qmsk.business.bussBill.bussBill.dao.BussBillDao;
/*      */ import com.qmsk.business.manage.cust.dao.CustDAO;
/*      */ import com.qmsk.business.manage.cust.dao.CustShopDAO;
/*      */ import com.qmsk.business.manage.mpCity.dao.MpCityDAO;
/*      */ import com.qmsk.business.manage.user.dao.UserDAO;
/*      */ import com.qmsk.business.member.member.dao.MemberDAO;
/*      */ import com.qmsk.business.member.member.params.MemberState;
/*      */ import com.qmsk.business.member.memberDepositConsumeRecord.dao.MemberDepositConsumeRecordDAO;
/*      */ import com.qmsk.business.member.memberIntegralBill.dao.MemberIntegralBillDao;
/*      */ import com.qmsk.business.member.memberIntegralDetail.dao.MemberIntegralDetailDAO;
/*      */ import com.qmsk.business.member.memberIntegralRule.dao.MemberIntegralRuleDAO;
/*      */ import com.qmsk.business.member.memberIntegralRule.service.MemberIntegralRuleService;
/*      */ import com.qmsk.business.member.memberLevel.dao.MemberLevelDAO;
/*      */ import com.qmsk.business.member.memberServiceBill.dao.MemberServiceBillDAO;
/*      */ import com.qmsk.business.member.memberServiceBillDetail.dao.MemberServiceBillDetailDAO;
/*      */ import com.qmsk.business.member.memberServiceDetail.dao.MemberServiceDetailDAO;
/*      */ import com.qmsk.business.member.memberWx.dao.MemberWxDAO;
/*      */ import com.qmsk.business.member.shopMember.dao.ShopMemberDAO;
/*      */ import com.qmsk.business.shopList.ShopMap;
/*      */ import com.qmsk.business.weixin.customMenu.customer.CustomerInfo;
/*      */ import com.qmsk.business.weixin.customMenu.weiXinUtil.WeiXinUtil;
/*      */ import com.qmsk.business.weixin.customMenu.wxMapUtils.WxMapUtils;
/*      */ import com.qmsk.session.UserSessionInfo;
/*      */ import com.utils.basic.CDateTimeComm;
/*      */ import com.utils.basic.MapUtils;
/*      */ import com.utils.basic.ObjectComm;
/*      */ import com.utils.gson.in.GsonHeadOneRow;
/*      */ import com.utils.gson.in.ParserDataSetJson;
/*      */ import com.utils.gson.out.GsonEbRst;
/*      */ import com.utils.gson.out.GsonEbRstLong;
/*      */ import com.utils.http.HttpGsonPtResponseUtils;
/*      */ import com.utils.http.HttpGsonPtUtils;
/*      */ import com.utils.jdbc.connection.DbConnection;
/*      */ import com.utils.web.RequestUtils;
/*      */ import com.utils.web.ResponseUtils;
/*      */ import java.io.IOException;
/*      */ import java.sql.SQLException;
/*      */ import java.util.Date;
/*      */ import java.util.HashMap;
/*      */ import java.util.List;
/*      */ import java.util.Map;
/*      */ import javax.servlet.http.HttpServletRequest;
/*      */ import javax.servlet.http.HttpServletResponse;
/*      */ import org.apache.commons.lang.StringUtils;
/*      */ import org.apache.log4j.Logger;
/*      */ import org.springframework.beans.factory.annotation.Autowired;
/*      */ import org.springframework.stereotype.Controller;
/*      */ import org.springframework.transaction.annotation.Transactional;
/*      */ import org.springframework.web.bind.annotation.PathVariable;
/*      */ import org.springframework.web.bind.annotation.RequestMapping;
/*      */ 
/*      */ @Controller
/*      */ @RequestMapping({"/custMember"})
/*      */ public class CustMemberController
/*      */ {
/*   62 */   private static final Logger logger = Logger.getLogger(CustMemberController.class);
/*      */ 
/*      */   @Autowired
/*      */   private CustDAO dao;
/*      */ 
/*      */   @Autowired
/*      */   private CustShopDAO custShopDao;
/*      */ 
/*      */   @Autowired
/*      */   private MpCityDAO mpCityDAO;
/*      */ 
/*      */   @Autowired
/*      */   private MemberDAO memberDao;
/*      */ 
/*      */   @Autowired
/*      */   private MemberLevelDAO memberLeveldao;
/*      */ 
/*      */   @Autowired
/*      */   private ShopMemberDAO shopMemberDAO;
/*      */ 
/*      */   @Autowired
/*      */   private MemberServiceBillDAO memberServiceBillDAO;
/*      */ 
/*      */   @Autowired
/*      */   private MemberServiceBillDetailDAO memberServiceBillDetailDAO;
/*      */ 
/*      */   @Autowired
/*      */   private MemberServiceDetailDAO memberServiceDetailDAO;
/*      */ 
/*      */   @Autowired
/*      */   private BussBillDao bussBillDao;
/*      */ 
/*      */   @Autowired
/*      */   private MemberDepositConsumeRecordDAO memberDepositConsumeRecordDAO;
/*      */ 
/*      */   @Autowired
/*      */   private MemberWxDAO memberWxDao;
/*      */ 
/*      */   @Autowired
/*      */   private MemberIntegralRuleDAO memberIntegralRuleDAO;
/*      */ 
/*      */   @Autowired
/*      */   private MemberIntegralBillDao memberIntegralBillDao;
/*      */ 
/*      */   @Autowired
/*      */   private MemberIntegralDetailDAO integralDetailDAO;
/*      */ 
/*      */   @Autowired
/*      */   private UserDAO userDAO;
/*      */ 
/*      */   @Autowired
/*      */   private MemberIntegralRuleService memberIntegralRuleService;
/*      */ 
/*      */   @Autowired
/*      */   private CustDAO custDao;
/*      */ 
/*      */   @RequestMapping(value={"find/shopId/{shopId}/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*      */   public void getListAll(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Integer shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*      */   {
/*  133 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*      */     try {
/*  135 */       GsonEbRst gsonEbRst = this.dao.getGsonOfShopId(shopId, nPageIdx, 
/*  136 */         nPageSize);
/*  137 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*      */     } catch (SQLException e) {
/*  139 */       logger.error(e);
/*  140 */       ResponseUtils.setErrorMsgResponse(
/*  141 */         RequestUtils.getFindDataErrorMessage(request), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   @RequestMapping(value={"find/shopId/{shopId}/opt1/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*      */   public void getListOpt1(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId2, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*      */   {
/*  150 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*      */     try {
/*  152 */       Long shopId = ObjectComm.objectToLong(RequestUtils.getLong(request, "shopId"));
/*  153 */       Long cityId = ObjectComm.objectToLong(RequestUtils.getLong(request, "cityId"));
/*  154 */       Map params = new HashMap();
/*  155 */       if (shopId != null)
/*  156 */         MapUtils.addToMap(params, "shopId", shopId);
/*      */       else {
/*  158 */         MapUtils.addToMap(params, "groupId", 
/*  159 */           ShopMap.getGroupIdOfShopId(shopId2));
/*      */       }
/*  161 */       if (cityId != null) {
/*  162 */         MapUtils.addToMap(params, "cityId", cityId);
/*      */       }
/*      */ 
/*  170 */       Long memberId = ObjectComm.objectToLong(RequestUtils.getLong(
/*  171 */         request, "memberId"));
/*  172 */       if ((memberId != null) && (memberId.longValue() > 0L)) {
/*  173 */         MapUtils.addToMap(params, "memberId", memberId);
/*      */       }
/*  175 */       MapUtils.addPercentToMap(params, "mp", 
/*  176 */         RequestUtils.getString(request, "mp"));
/*  177 */       MapUtils.addPercentToMap(params, "custName", 
/*  178 */         RequestUtils.getString(request, "custName"));
/*  179 */       MapUtils.addPercentToMap(params, "CardNo", 
/*  180 */         RequestUtils.getString(request, "CarNo"));
/*  181 */       MapUtils.addPercentToMap(params, "addr", 
/*  182 */         RequestUtils.getString(request, "addr"));
/*  183 */       MapUtils.addPercentToMap(params, "tel", 
/*  184 */         RequestUtils.getString(request, "tel"));
/*  185 */       MapUtils.addPercentToMap(params, "idNum", 
/*  186 */         RequestUtils.getString(request, "idNum"));
/*  187 */       MapUtils.addToMap(params, "dtBirthBegin", 
/*  188 */         RequestUtils.getDate(request, "dtBirthBegin"));
/*  189 */       MapUtils.addToMap(params, "dtBirthEnd", 
/*  190 */         RequestUtils.getDate(request, "dtBirthEnd"));
/*  191 */       MapUtils.addToMap(params, "status", 
/*  192 */         RequestUtils.getInt(request, "status"));
/*  193 */       MapUtils.addToMap(params, "levelId", 
/*  194 */         RequestUtils.getInt(request, "levelId"));
/*  195 */       MapUtils.addToMap(params, "custId", 
/*  196 */         RequestUtils.getInt(request, "custId"));
/*  197 */       GsonEbRst gsonEbRst = null;
/*  198 */       gsonEbRst = this.shopMemberDAO.getGsonOfShopIdOpt1(params, nPageIdx, 
/*  199 */         nPageSize);
/*  200 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*      */     } catch (SQLException e) {
/*  202 */       logger.error(e);
/*  203 */       ResponseUtils.setErrorMsgResponse(
/*  204 */         RequestUtils.getFindDataErrorMessage(request), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   private int insertPtShopCust(Long shopId, Long outId, HttpServletResponse response) throws Exception
/*      */   {
/*  210 */     GsonEbRst rst = null;
/*  211 */     String sData = "outId=" + outId + "&shopId=" + 
/*  212 */       ShopMap.getOutIdOfShopId(shopId);
/*  213 */     String sUrl = "ptcust/insert/shopCust";
/*  214 */     if ((ShopMap.getOutIdOfShopId(shopId) != null) && 
/*  215 */       (ShopMap.getOutIdOfShopId(shopId).longValue() > 0L)) {
/*  216 */       rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, response);
/*      */     }
/*  218 */     if (rst.isSuccess()) {
/*  219 */       return 1;
/*      */     }
/*  221 */     return 0;
/*      */   }
/*      */ 
/*      */   private int insertPtShopMember(Long shopId, Long outMId, Long groupId, Date validayTime, Object LevelID, String cardNo, Integer validDay, Double discount, HttpServletResponse response)
/*      */     throws Exception
/*      */   {
/*  228 */     GsonEbRst rst = null;
/*  229 */     String sData = "outMId=" + outMId + "&shopId=" + 
/*  230 */       ShopMap.getOutIdOfShopId(shopId) + "&groupId=" + groupId + 
/*  231 */       "&validayTime=" + validayTime + "&LevelID=" + LevelID + 
/*  232 */       "&cardNo=" + cardNo + "&validDay=" + validDay + "&discount=" + 
/*  233 */       discount;
/*  234 */     String sUrl = "ptmember/insert/shopMember";
/*  235 */     if ((ShopMap.getOutIdOfShopId(shopId) != null) && 
/*  236 */       (ShopMap.getOutIdOfShopId(shopId).longValue() > 0L)) {
/*  237 */       rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, response);
/*      */     }
/*  239 */     if (rst.isSuccess()) {
/*  240 */       return 1;
/*      */     }
/*  242 */     return 0;
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"insert/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void insertList(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*      */   {
/*      */     try
/*      */     {
/*  259 */       int nResult = 0;
/*  260 */       Long id = null;
/*  261 */       Long outId = null;
/*  262 */       String custName = null;
/*  263 */       Long outMId = null;
/*      */ 
/*  265 */       Long custId = null;
/*  266 */       Double discount = null;
/*  267 */       Long memberId = null;
/*  268 */       Long lMemberId = Long.valueOf(0L);
/*  269 */       Long outSId = null;
/*  270 */       GsonHeadOneRow gs = ShopMap.getHeadOneRowOfShopId(shopId);
/*  271 */       if (gs != null) {
/*  272 */         outSId = ObjectComm.objectToLong(gs.getValueOfName("outId"));
/*      */       }
/*  274 */       String sData = RequestUtils.getStringOfData(request);
/*  275 */       ParserDataSetJson p = ParserDataSetJson.fromString(sData);
/*  276 */       if ((p != null) && 
/*  277 */         (p.isExistsInsertRows())) {
/*  278 */         for (int i = 0; i < p.getListInsertRows().size(); ++i) {
/*  279 */           GsonHeadOneRow r = (GsonHeadOneRow)p.getListInsertRows().get(i);
/*  280 */           if (r != null) {
/*  281 */             String mp = (String)r.getValueOfName("Mp");
/*  282 */             if (mp != null) {
/*  283 */               custId = this.dao.getUserIdOfMp(mp);
/*  284 */               if (custId.longValue() > 0L) {
/*  285 */                 memberId = this.memberDao
/*  286 */                   .selectMemberIdOfCustId(custId);
/*  287 */                 outId = this.dao.getOutId(custId);
/*  288 */                 id = custId;
/*      */               } else {
/*  290 */                 String StrNum = StringUtils.substring(mp, 
/*  291 */                   0, 7);
/*  292 */                 if (!(this.mpCityDAO.getCheckMp(StrNum).booleanValue())) {
/*  293 */                   ResponseUtils.setErrorMsgResponse(
/*  294 */                     "手机号码不合法", response);
/*  295 */                   return;
/*      */                 }
/*  297 */                 custName = (String)r
/*  298 */                   .getValueOfName("name");
/*  299 */                 r.autoAddHeadData("Status", Integer.valueOf(0));
/*  300 */                 r.autoAddHeadData("CreateFileTime", 
/*  301 */                   new Date());
/*  302 */                 logger.info("Toptcust");
/*  303 */                 if ((outSId != null) && (outSId.longValue() > 0L)) {
/*  304 */                   outId = getPtCustIdOfInsertPt(
/*  305 */                     r.objectToJsonStr(), 
/*  306 */                     String.valueOf(outSId), 
/*  307 */                     response);
/*  308 */                   if ((outId == null) || (outId.longValue() <= 0L))
/*  309 */                     logger.error("获取outId失败");
/*      */                   else {
/*  311 */                     r.autoAddHeadData("outId", outId);
/*      */                   }
/*      */                 }
/*  314 */                 nResult = this.dao.applyUpdates(p, "id");
/*  315 */                 if (nResult > 0) {
/*  316 */                   id = ObjectComm.objectToLong(r
/*  317 */                     .getValueOfName("id"));
/*  318 */                   if ((id == null) || (id.longValue() <= 0L) || 
/*  320 */                     (this.custShopDao.exitsShopCust(id, 
/*  320 */                     shopId).intValue() >= 
/*  320 */                     1)) continue;
/*  321 */                   nResult = this.custShopDao
/*  322 */                     .insertParams(new Object[] { 
/*  323 */                     shopId, id }).intValue();
/*      */ 
/*  324 */                   if (nResult > 0)
/*      */                     continue;
/*  326 */                   ResponseUtils.setErrorMsgResponse(
/*  327 */                     "custShop添加失败", 
/*  328 */                     response);
/*      */                 }
/*      */               }
/*      */             }
/*      */ 
/*      */           }
/*      */           else
/*      */           {
/*  336 */             ResponseUtils.setErrorMsgResponse("没有请求参数", 
/*  337 */               response);
/*  338 */             return;
/*      */           }
/*      */         }
/*  341 */         if ((custId != null) && (custId.longValue() > 0L) && 
/*  342 */           (this.custShopDao.exitsShopCust(custId, shopId).intValue() < 1)) {
/*  343 */           nResult = this.custShopDao.insertParams(new Object[] { 
/*  344 */             shopId, custId }).intValue();
/*      */ 
/*  345 */           if (nResult <= 0) {
/*  346 */             ResponseUtils.setErrorMsgResponse(
/*  347 */               "custShop添加失败", response);
/*      */           }
/*  349 */           else if ((outId != null) && (outId.longValue() > 0L))
/*  350 */             insertPtShopCust(shopId, outId, response);
/*      */           else {
/*  352 */             logger.error("获取outId失败");
/*      */           }
/*      */ 
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/*  361 */       String memberCardNo = null;
/*  362 */       if ((nResult > 0) || (p == null) || (p.isExistsRows())) {
/*  363 */         ParserDataSetJson pMember = 
/*  364 */           ParserDataSetJson.fromString(RequestUtils.getString(request, "member"));
/*  365 */         if (pMember != null) {
/*  366 */           Long groupId = ObjectComm.objectToLong(gs
/*  367 */             .getValueOfName("groupId"));
/*  368 */           String createFileMan = 
/*  369 */             UserSessionInfo.getUserNameOfRequest(request);
/*  370 */           Date greatTime = null;
/*  371 */           Date validDateTmie = null;
/*  372 */           Long levelID = Long.valueOf(0L);
/*  373 */           Integer validDay = Integer.valueOf(0);
/*      */           int i;
/*      */           GsonHeadOneRow g;
/*      */           int count;
/*  374 */           if ((pMember.isExistsInsertRows()) && ((
/*  375 */             (memberId == null) || (memberId.longValue() <= 0L)))) {
/*  376 */             for (i = 0; i < pMember.getListInsertRows().size(); ++i) {
/*  377 */               g = (GsonHeadOneRow)pMember.getListInsertRows().get(
/*  378 */                 i);
/*  379 */               if (g.getValueOfName("DepositAmount") == null) {
/*  380 */                 g.autoAddHeadData("DepositAmount", Integer.valueOf(0));
/*      */               }
/*  382 */               if (g.getValueOfName("IntegralAmount") == null) {
/*  383 */                 g.autoAddHeadData("IntegralAmount", Integer.valueOf(0));
/*      */               }
/*  385 */               if (g.getValueOfName("ConsumeAmount") == null) {
/*  386 */                 g.autoAddHeadData("ConsumeAmount", Integer.valueOf(0));
/*      */               }
/*  388 */               if (g.getValueOfName("CashCouponAmount") == null) {
/*  389 */                 g.autoAddHeadData("CashCouponAmount", Integer.valueOf(0));
/*      */               }
/*  391 */               if (g.getValueOfName("CouponAmount") == null) {
/*  392 */                 g.autoAddHeadData("CouponAmount", Integer.valueOf(0));
/*      */               }
/*  394 */               if (id != null) {
/*  395 */                 g.autoAddHeadData("CustID", id);
/*      */               }
/*  397 */               g.autoAddHeadData("status", Integer.valueOf(1));
/*  398 */               g.autoAddHeadData("CreateFileTime", new Date());
/*  399 */               discount = ObjectComm.objectToDouble(g
/*  400 */                 .getValueOfName("discount"));
/*  401 */               g.delHead("discount");
/*  402 */               g.encryptHead("payPwd");
/*  403 */               levelID = ObjectComm.objectToLong(
/*  404 */                 g.getValueOfName("LevelId"), Long.valueOf(0L));
/*  405 */               if ((levelID != null) && (levelID.longValue() > 0L)) {
/*  406 */                 validDay = Integer.valueOf(this.memberLeveldao.getValidDay(shopId, 
/*  407 */                   levelID));
/*  408 */                 if (validDay.intValue() <= 0)
/*  409 */                   g.autoAddHeadData("ValidDateTime", 
/*  410 */                     CDateTimeComm.getAddYear(
/*  411 */                     new Date(), 100));
/*      */                 else {
/*  413 */                   g.autoAddHeadData("ValidDateTime", 
/*  414 */                     CDateTimeComm.getAddDate(
/*  415 */                     new Date(), validDay.intValue()));
/*      */                 }
/*      */               }
/*  418 */               greatTime = CDateTimeComm.objectToDate(g
/*  419 */                 .getValueOfName("CreateFileTime"));
/*  420 */               validDateTmie = CDateTimeComm.objectToDate(g
/*  421 */                 .getValueOfName("ValidDateTime"));
/*  422 */               memberCardNo = (String)g
/*  423 */                 .getValueOfName("MemberCardNo");
/*  424 */               if (StringUtils.isNotEmpty(memberCardNo)) {
/*  425 */                 count = this.shopMemberDAO.getCardNoIsExsit(
/*  426 */                   memberCardNo, shopId);
/*  427 */                 if (count >= 1) {
/*  428 */                   DbConnection.rollback();
/*  429 */                   ResponseUtils.setErrorMsgResponse(
/*  430 */                     "已有相同的会员卡号", response);
/*  431 */                   return;
/*      */                 }
/*      */               }
/*      */             }
/*  435 */             nResult = this.memberDao.applyUpdates(pMember, "id");
/*  436 */             if (nResult > 0) {
/*  437 */               GsonHeadOneRow r = (GsonHeadOneRow)pMember.getListInsertRows().get(
/*  438 */                 0);
/*  439 */               lMemberId = ObjectComm.objectToLong(r
/*  440 */                 .getValueOfName("id"));
/*  441 */               if ((lMemberId != null) && (lMemberId.longValue() > 0L)) {
/*  442 */                 if (memberCardNo == null) {
/*  443 */                   memberCardNo = 
/*  444 */                     ShopMap.getCardFlagOfShopId(shopId) + 
/*  445 */                     String.valueOf(lMemberId);
/*      */                 }
/*  447 */                 if ((outSId != null) && (outSId.longValue() > 0L) && 
/*  448 */                   (outId != null) && (outId.longValue() > 0L)) {
/*  449 */                   r.autoAddHeadData("MemberCardNo", 
/*  450 */                     memberCardNo);
/*  451 */                   outMId = getMemberIdPtLong(
/*  452 */                     r.objectToJsonStr(), 
/*  453 */                     gs.objectToJsonStr(), groupId, 
/*  454 */                     outId, discount, response);
/*  455 */                   if ((outMId == null) || (outMId.longValue() <= 0L)) {
/*  456 */                     logger.error("获取outMId失败");
/*      */                   }
/*      */                 }
/*  459 */                 nResult = this.memberDao.updateCardNoOfId(
/*  460 */                   memberCardNo, outMId, lMemberId);
/*  461 */                 if (nResult > 0) {
/*  462 */                   nResult = saveAfter(lMemberId, validDay, 
/*  463 */                     shopId, groupId, createFileMan, 
/*  464 */                     custName, levelID, greatTime, 
/*  465 */                     validDateTmie, true, "", 
/*  466 */                     memberCardNo, discount, response);
/*      */                 }
/*      */               }
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*  473 */           if ((memberId != null) && (memberId.longValue() > 0L)) {
/*  474 */             for (i = 0; i < pMember.getListInsertRows().size(); ++i) {
/*  475 */               g = (GsonHeadOneRow)pMember.getListInsertRows().get(
/*  476 */                 i);
/*  477 */               levelID = ObjectComm.objectToLong(
/*  478 */                 g.getValueOfName("LevelId"), Long.valueOf(0L));
/*  479 */               if ((levelID != null) && (levelID.longValue() > 0L)) {
/*  480 */                 validDay = Integer.valueOf(this.memberLeveldao.getValidDay(shopId, 
/*  481 */                   levelID));
/*  482 */                 if (validDay.intValue() <= 0)
/*  483 */                   g.autoAddHeadData("ValidDateTime", 
/*  484 */                     CDateTimeComm.getAddYear(
/*  485 */                     new Date(), 100));
/*      */                 else {
/*  487 */                   g.autoAddHeadData("ValidDateTime", 
/*  488 */                     CDateTimeComm.getAddDate(
/*  489 */                     new Date(), validDay.intValue()));
/*      */                 }
/*      */               }
/*  492 */               greatTime = CDateTimeComm.objectToDate(g
/*  493 */                 .getValueOfName("CreateFileTime"));
/*  494 */               validDateTmie = CDateTimeComm.objectToDate(g
/*  495 */                 .getValueOfName("ValidDateTime"));
/*  496 */               memberCardNo = (String)g
/*  497 */                 .getValueOfName("MemberCardNo");
/*  498 */               if (StringUtils.isNotEmpty(memberCardNo)) {
/*  499 */                 count = this.shopMemberDAO.getCardNoIsExsit(
/*  500 */                   memberCardNo, shopId);
/*  501 */                 if (count >= 1) {
/*  502 */                   DbConnection.rollback();
/*  503 */                   ResponseUtils.setErrorMsgResponse(
/*  504 */                     "已有相同的会员卡号", response);
/*  505 */                   return;
/*      */                 }
/*      */               } else {
/*  508 */                 memberCardNo = 
/*  509 */                   ShopMap.getCardFlagOfShopId(shopId) + 
/*  510 */                   String.valueOf(memberId);
/*      */               }
/*  512 */               outMId = this.memberDao.getOutMIdOfId(memberId);
/*  513 */               logger.debug("outMId====" + outMId);
/*  514 */               if (((outMId == null) && (outSId != null)) || ((outMId.longValue() <= 0L) && 
/*  515 */                 (outSId != null))) {
/*  516 */                 outMId = getMemberIdPtLong(g.objectToJsonStr(), 
/*  517 */                   gs.objectToJsonStr(), groupId, outId, 
/*  518 */                   discount, response);
/*      */               }
/*  520 */               nResult = saveAfter2(memberId, validDay, shopId, 
/*  521 */                 groupId, levelID, validDateTmie, 
/*  522 */                 memberCardNo, discount, outMId, response);
/*      */             }
/*      */           }
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/*  529 */       if (nResult > 0) {
/*  530 */         DbConnection.commit();
/*  531 */         if (id != null) {
/*  532 */           String[] heads = { "Id", "mId", "cardNo" };
/*  533 */           Object[] datas = { id, lMemberId, memberCardNo };
/*  534 */           ResponseUtils.toGsonEbRst(heads, datas, response);
/*  535 */           return; }
/*  536 */         ResponseUtils.setSqlResultResponse(nResult, 
/*  537 */           RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  538 */           response);
/*      */ 
/*  540 */         return; }
/*  541 */       DbConnection.rollback();
/*  542 */       ResponseUtils.setSqlResultResponse(nResult, 
/*  543 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  544 */         response);
/*      */     }
/*      */     catch (Exception e) {
/*  547 */       DbConnection.rollback();
/*  548 */       logger.error(e);
/*  549 */       ResponseUtils.setErrorMsgResponse(
/*  550 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/*  551 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"insert/BD"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void bd(HttpServletRequest request, HttpServletResponse response)
/*      */   {
/*      */     try
/*      */     {
/*  567 */       Long shopId = RequestUtils.getLong(request, "shopId");
/*  568 */       String name = RequestUtils.getString(request, "name");
/*  569 */       String mp = RequestUtils.getString(request, "mp");
/*  570 */       String openId = RequestUtils.getString(request, "openId");
/*      */ 
/*  573 */       if (this.dao.checkOpenId(openId) > 0) {
/*  574 */         ResponseUtils.setErrorMsgResponse("您的微信号已绑定", response);
/*  575 */         return;
/*      */       }
/*      */ 
/*  578 */       GsonHeadOneRow cust = this.dao.getCustInfo(name, mp);
/*  579 */       GsonHeadOneRow memberRuleRow = this.memberIntegralRuleDAO
/*  580 */         .getGsonOneRowOfNameAndMemberIdAndCus("会员注册");
/*  581 */       Integer intAmt = Integer.valueOf(0);
/*  582 */       if (memberRuleRow != null) {
/*  583 */         intAmt = 
/*  584 */           ObjectComm.objectToInteger(memberRuleRow
/*  585 */           .getValueOfName("FixedIntegral"));
/*      */       }
/*  587 */       if (cust != null) {
/*  588 */         String openId2 = ObjectComm.objectToString(cust.getValueOfName("openId"));
/*  589 */         if (StringUtils.isNotEmpty(openId2)) {
/*  590 */           ResponseUtils.setErrorMsgResponse("此姓名已绑定微信", response);
/*  591 */           return;
/*      */         }
/*  593 */         Long memberId = ObjectComm.objectToLong(cust.getValueOfName("memberId"));
/*  594 */         Long customerId = ObjectComm.objectToLong(cust.getValueOfName("customerId"));
/*  595 */         String[] head = { "imageUrl", "openId", "id" };
/*      */ 
/*  597 */         String imageUrl = null;
/*      */ 
/*  609 */         Object[] data = { imageUrl, openId, customerId };
/*  610 */         int nresult = this.dao.updateJsonOneRow(new GsonHeadOneRow(head, data));
/*      */   
/*      */         Long custId;
/*      */         String content;
/*  611 */         if (nresult > 0) {
/*  612 */           String userName = null;
/*  613 */           String usermp = null;
/*  614 */           Long managerId = Long.valueOf(0L);
/*  615 */           String duty = "客户经理";
/*      */ 
/*  617 */           logger.error("openId:" + openId);
/*      */ 
/*  619 */           if (cust != null) {
/*  620 */             logger.error("***+*****************" + cust.toString());
/*  621 */             managerId = ObjectComm.objectToLong(cust.getValueOfName("managerId"));
/*  622 */             logger.error("mangerId" + managerId);
/*  623 */             if ((managerId == null) || (managerId.longValue() <= 0L))
/*      */             {
/*  626 */               managerId = ObjectComm.objectToLong(cust.getValueOfName("serviceManagerId"));
/*  627 */               duty = "客服经理";
/*      */             }
/*      */ 
/*  630 */             logger.error("sssss" + managerId);
/*  631 */             if ((managerId != null) && (managerId.longValue() > 0L)) {
/*  632 */               GsonHeadOneRow user = this.userDAO.selectUserById(managerId);
/*  633 */               if (user != null) {
/*  634 */                 userName = (String)user.getValueOfName("name");
/*  635 */                 usermp = (String)user.getValueOfName("mp");
/*      */               }
/*      */             }
/*      */           } else {
/*  639 */             logger.error("***nomanger*****");
/*      */           }
/*      */ 
/*  642 */            content = "尊敬的" + name + ",我们已绑定您在我店的档案信息";
/*  643 */           if (StringUtils.isNotEmpty(userName)) {
/*  644 */             content = content + ",我是您的" + duty + ":" + userName;
/*      */           }
/*  646 */           if (StringUtils.isNotEmpty(usermp)) {
/*  647 */             content = content + ",手机号:" + usermp;
/*      */           }
/*  649 */           if (intAmt.intValue() > 0) {
/*  650 */             content = content + ",您已获得" + intAmt + "积分";
/*      */           }
/*      */ 
/*  653 */           if ((memberId != null) && (memberId.longValue() > 0L)) {
/*  654 */             Map result = this.memberIntegralRuleService.sendIntegralOfRuleName("微信绑定", memberId, shopId);
/*  655 */             nresult = ((Integer)result.get("nResult")).intValue();
/*  656 */             if (nresult > 0) {
/*  657 */               this.dao.commit();
/*      */ 
/*  659 */               WeiXinUtil.sendTextMessageOfMain(content, openId);
/*  660 */               ResponseUtils.toGsonEbRst(new String[] { "noInfo" }, new Object[] { "0" }, response);
/*  661 */               return;
/*      */             }
/*  663 */             ResponseUtils.setSqlResultResponse(nresult, RequestUtils.getSqlUpdateDataErrorMessage(request), response);
/*      */           }
/*      */           else {
/*  666 */             nresult = getGsonOfInsertCustMember(openId, shopId, name, mp, customerId);
/*  667 */             if (nresult > 0) {
/*  668 */               DbConnection.commit();
/*  669 */               WeiXinUtil.sendTextMessageOfMain(content, openId);
/*  670 */               ResponseUtils.setSqlResultResponse(nresult, RequestUtils.getSqlUpdateDataErrorMessage(request), response);
/*  671 */               return;
/*      */             }
/*  673 */             DbConnection.rollback();
/*      */ 
/*  676 */             ResponseUtils.setSqlResultResponse(nresult, RequestUtils.getSqlUpdateDataErrorMessage(request), response);
/*      */ 
/*  680 */             return; } } }
/*  681 */       int nresult = 0;
/*  682 */       Long custId = this.custDao.getUserIdOfMp(mp);
/*  683 */       if (custId.longValue() > 0L) {
/*  684 */         ResponseUtils.setErrorMsgResponse("该手机号已注册", response);
/*  685 */         return;
/*      */       }
/*  687 */       nresult = getGsonOfLevelid(nresult, name, openId, mp, shopId, request, response);
/*  688 */       if (nresult > 0) {
/*  689 */         String content = "尊敬的" + name + ",我们已绑定您在我店的档案信息";
/*  690 */         if (intAmt.intValue() > 0) {
/*  691 */           content = content + ",您已获得" + intAmt + "积分";
/*      */         }
/*  693 */         DbConnection.commit();
/*  694 */         WeiXinUtil.sendTextMessageOfMain(content, openId);
/*      */       } else {
/*  696 */         DbConnection.rollback();
/*      */       }
/*      */ 
/*  699 */       ResponseUtils.setSqlResultResponse(nresult, RequestUtils.getSqlUpdateDataErrorMessage(request), response);
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*  704 */       DbConnection.rollback();
/*  705 */       logger.error(e);
/*  706 */       ResponseUtils.setErrorMsgResponse(
/*  707 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/*  708 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   private int getGsonOfInsertCustMember(String openId, Long shopId, String userName, String mp, Long custId) throws SQLException
/*      */   {
/*  714 */     int nResult = 0;
/*  715 */     Integer intAmt = Integer.valueOf(0);
/*  716 */     String nickName = null;
/*  717 */     String memberCardNo = null;
/*  718 */     GsonHeadOneRow rowMemberLevel = null;
/*  719 */     Long levelId = this.memberWxDao.selectSqlOfDefaultParamsShop(shopId, 1);
/*  720 */     if (levelId != null) {
/*  721 */       rowMemberLevel = this.memberLeveldao.getGsonOfLevelId(levelId);
/*      */     }
/*  723 */     Long memberId = null;
/*  724 */     Date crTime = new Date();
/*  725 */     if (custId.longValue() > 0L) {
/*  726 */       GsonHeadOneRow s = new GsonHeadOneRow(new String[] { 
/*  727 */         "custId", "shopId" }, new Object[] { 
/*  728 */         custId, shopId });
/*  729 */       nResult = this.custShopDao.insertGsonHeadOneRow(s);
/*      */     }
/*  731 */     if ((custId.longValue() > 0L) && (nResult > 0)) {
/*  732 */       String[] headMember = { "CustID", 
/*  733 */         "status", "CreateFileTime", "payPwd", 
/*  734 */         "LevelID", "DepositAmount", 
/*  735 */         "IntegralAmount", "ConsumeAmount", 
/*  736 */         "CashCouponAmount", "CouponAmount" };
/*  737 */       Object[] dataMember = { custId, 
/*  738 */         Integer.valueOf(2), new Date(), "111111", 
/*  739 */         levelId, Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0) };
/*  740 */       GsonHeadOneRow gMember = new GsonHeadOneRow(
/*  741 */         headMember, dataMember);
/*  742 */       gMember.encryptHead("payPwd");
/*  743 */       Integer validDay = null;
/*  744 */       Double discount = null;
/*  745 */       if ((levelId != null) && (levelId.longValue() > 0L)) {
/*  746 */         validDay = 
/*  747 */           ObjectComm.objectToInteger(rowMemberLevel
/*  748 */           .getValueOfName("ValidDay"));
/*  749 */         if (validDay.intValue() <= 0)
/*  750 */           gMember.autoAddHeadData("ValidDateTime", 
/*  751 */             CDateTimeComm.getAddYear(crTime, 
/*  752 */             100));
/*      */         else {
/*  754 */           gMember.autoAddHeadData("ValidDateTime", 
/*  755 */             CDateTimeComm.getAddDay(crTime, 
/*  756 */             validDay.intValue()));
/*      */         }
/*  758 */         discount = 
/*  759 */           ObjectComm.objectToDouble(rowMemberLevel
/*  760 */           .getValueOfName("discount"));
/*  761 */         gMember.autoAddHeadData("ValidDay", validDay);
/*  762 */         gMember.autoAddHeadData("DisCount", discount);
/*      */       }
/*  764 */       nResult = this.memberDao.insertGsonHeadOneRow(gMember);
/*  765 */       memberId = this.memberDao.getLastId();
/*  766 */       if ((nResult > 0) && (memberId.longValue() > 0L)) {
/*  767 */         GsonHeadOneRow memberRuleRow = this.memberIntegralRuleDAO
/*  768 */           .getGsonOneRowOfNameAndMemberIdAndCus("会员注册");
/*  769 */         if (memberRuleRow != null) {
/*  770 */           intAmt = 
/*  771 */             ObjectComm.objectToInteger(memberRuleRow
/*  772 */             .getValueOfName("FixedIntegral"));
/*  773 */           if (intAmt.intValue() > 0) {
/*  774 */             Long ruId = (Long)memberRuleRow
/*  775 */               .getValueOfName("RuleID");
/*  776 */             String billNo = this.memberIntegralBillDao
/*  777 */               .getMaxBillNo(shopId);
/*  778 */             nResult = this.memberIntegralBillDao
/*  779 */               .insertIntegralBill(memberId, 
/*  780 */               shopId, billNo, ruId, 
/*  781 */               intAmt, "微信绑定", 
/*  782 */               crTime, userName, 1, 
/*  783 */               "wx", "微信绑定");
/*  784 */             if (nResult > 0) {
/*  785 */               Long billId = this.memberIntegralBillDao
/*  786 */                 .getLastId();
/*  787 */               nResult = this.integralDetailDAO
/*  788 */                 .insertBusBillDtialInAmt(
/*  789 */                 memberId, shopId, 
/*  790 */                 intAmt, Integer.valueOf(0), billId);
/*      */             }
/*      */           } else {
/*  793 */             logger.error("无可添加的积分");
/*      */           }
/*      */         }
/*      */ 
/*  797 */         memberCardNo = mp;
/*  798 */         Long groupId = 
/*  799 */           ShopMap.getGroupIdOfShopId(shopId);
/*  800 */         gMember.delHead(new String[] { "CustID" });
/*  801 */         gMember.addHeadData(new String[] { 
/*  802 */           "MemberID", "ShopID", "groupId", 
/*  803 */           "IsCreateShop", "MemberCardNo" }, new Object[] { 
/*  804 */           memberId, shopId, groupId, Integer.valueOf(1), memberCardNo });
/*      */ 
/*  806 */         if (intAmt.intValue() > 0) {
/*  807 */           gMember.autoAddHeadData(
/*  808 */             "IntegralAmount", intAmt);
/*      */         }
/*  810 */         nResult = this.shopMemberDAO
/*  811 */           .insertGsonHeadOneRow(gMember, 
/*  812 */           "crm_shop_member");
/*      */       }
/*      */ 
/*  815 */       if (nResult > 0) {
/*  816 */         GsonHeadOneRow a = new GsonHeadOneRow(new String[] { 
/*  817 */           "ShopID", "OpenID", "custName", "Status", 
/*  818 */           "CreateFileTime" }, new Object[] { shopId, 
/*  819 */           openId, nickName, Integer.valueOf(1), crTime });
/*  820 */         nResult = this.memberWxDao.insertGsonHeadOneRow(a, 
/*  821 */           "crm_memberapply");
/*      */       }
/*      */     }
/*      */ 
/*  825 */     return nResult;
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"edit/shopId/{shopId}/upgrade/{memberId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void updateResale(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("memberId") Long memberId)
/*      */   {
/*      */     try
/*      */     {
/*  842 */       int nResult = 0;
/*  843 */       Integer status = Integer.valueOf(6);
/*  844 */       Long outSId = ShopMap.getOutIdOfShopId(shopId);
/*  845 */       ParserDataSetJson p = new ParserDataSetJson(
/*  846 */         request.getParameter("data"));
/*  847 */       if (p != null) {
/*  848 */         if (p.isExistsUpdateRows()) {
/*  849 */           GsonHeadOneRow r = (GsonHeadOneRow)p.getListUpdateRows().get(0);
/*  850 */           Long id = ObjectComm.objectToLong(r.getValueOfName("id"));
/*  851 */           if (id == null) {
/*  852 */             DbConnection.rollback();
/*  853 */             ResponseUtils.setErrorMsgResponse("Id为空", response);
/*  854 */             return;
/*      */           }
/*  856 */           String mp = (String)r.getValueOfName("Mp");
/*  857 */           if (mp != null) {
/*  858 */             Long count = this.dao.getUserIdOfMp(mp);
/*  859 */             if (count.longValue() > 0L) {
/*  860 */               ResponseUtils.setErrorMsgResponse("手机号码为" + mp + 
/*  861 */                 "的客户已存在", response);
/*  862 */               return;
/*      */             }
/*  864 */             String StrNum = StringUtils.substring(mp, 0, 7);
/*  865 */             if (!(this.mpCityDAO.getCheckMp(StrNum).booleanValue())) {
/*  866 */               ResponseUtils.setErrorMsgResponse("手机号码不合法", 
/*  867 */                 response);
/*  868 */               return;
/*      */             }
/*      */           }
/*      */         }
/*  872 */         nResult = this.dao.applyUpdates(p);
/*      */       }
/*      */ 
/*  875 */       ParserDataSetJson pMember = 
/*  876 */         ParserDataSetJson.fromString(RequestUtils.getString(request, "member"));
/*  877 */       if (pMember == null) {
/*  878 */         GsonHeadOneRow r = new GsonHeadOneRow(new String[] { "status", 
/*  879 */           "id" }, 
/*  880 */           new Object[] { Integer.valueOf(6), memberId });
/*  881 */         Long id = memberId;
/*  882 */         if (id == null) {
/*  883 */           DbConnection.rollback();
/*  884 */           ResponseUtils.setErrorMsgResponse("Id为空", response);
/*  885 */           return;
/*      */         }
/*  887 */         Long outMId = this.memberDao.getOutMIdOfId(id);
/*  888 */         if ((outSId != null) && (outSId.longValue() > 0L) && 
/*  889 */           (outMId != null) && (outMId.longValue() > 0L)) {
/*  890 */           getPtMemberStatus(r.objectToJsonStr(), outMId, status, 
/*  891 */             outSId, response);
/*      */         }
/*  893 */         nResult = this.memberDao.updateJsonOneRow(r);
/*      */ 
/*  895 */         nResult = nResult + this.shopMemberDAO
/*  895 */           .updateMemberStatus(status, memberId, 
/*  895 */           shopId);
/*      */       } else {
/*  897 */         if (pMember.isExistsUpdateRows()) {
/*  898 */           for (int i = 0; i < pMember.getListUpdateRows().size(); ++i) {
/*  899 */             GsonHeadOneRow r = (GsonHeadOneRow)pMember.getListUpdateRows().get(i);
/*  900 */             r.autoAddHeadData("status", status);
/*  901 */             Long id = ObjectComm.objectToLong(r
/*  902 */               .getValueOfName("id"));
/*  903 */             if (id == null) {
/*  904 */               DbConnection.rollback();
/*  905 */               ResponseUtils.setErrorMsgResponse("Id为空", response);
/*  906 */               return;
/*      */             }
/*  908 */             Long outMId = this.memberDao.getOutMIdOfId(id);
/*  909 */             if ((outSId == null) || (outSId.longValue() <= 0L) || 
/*  910 */               (outMId == null) || (outMId.longValue() <= 0L)) continue;
/*  911 */             getPtMemberStatus(r.objectToJsonStr(), outMId, 
/*  912 */               status, outSId, response);
/*      */           }
/*      */         }
/*      */ 
/*  916 */         nResult += this.memberDao.applyUpdates(pMember);
/*      */ 
/*  918 */         nResult = nResult + this.shopMemberDAO
/*  918 */           .updateMemberStatus(status, memberId, 
/*  918 */           shopId);
/*      */       }
/*      */ 
/*  921 */       if (nResult > 0)
/*  922 */         DbConnection.commit();
/*      */       else {
/*  924 */         DbConnection.rollback();
/*      */       }
/*  926 */       ResponseUtils.setSqlResultResponse(nResult, 
/*  927 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/*  928 */         response);
/*      */     } catch (Exception e) {
/*  930 */       DbConnection.rollback();
/*  931 */       logger.error(e);
/*  932 */       ResponseUtils.setErrorMsgResponse(
/*  933 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/*  934 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"edit/shopId/{shopId}/lost/{memberId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void updateLost(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("memberId") Long memberId)
/*      */   {
/*      */     try
/*      */     {
/*  952 */       int nResult = 0;
/*      */ 
/*  954 */       Long outSId = ShopMap.getOutIdOfShopId(shopId);
/*  955 */       ParserDataSetJson p = new ParserDataSetJson(
/*  956 */         request.getParameter("data"));
/*  957 */       if (p != null) {
/*  958 */         if (p.isExistsUpdateRows()) {
/*  959 */           GsonHeadOneRow r = (GsonHeadOneRow)p.getListUpdateRows().get(0);
/*  960 */           Long id = ObjectComm.objectToLong(r.getValueOfName("id"));
/*  961 */           if (id == null) {
/*  962 */             DbConnection.rollback();
/*  963 */             ResponseUtils.setErrorMsgResponse("Id为空", response);
/*  964 */             return;
/*      */           }
/*  966 */           String mp = (String)r.getValueOfName("Mp");
/*  967 */           if (mp != null) {
/*  968 */             Long count = this.dao.getUserIdOfMp(mp);
/*  969 */             if (count.longValue() > 0L) {
/*  970 */               ResponseUtils.setErrorMsgResponse("手机号码为" + mp + 
/*  971 */                 "的客户已存在", response);
/*  972 */               return;
/*      */             }
/*  974 */             String StrNum = StringUtils.substring(mp, 0, 7);
/*  975 */             if (!(this.mpCityDAO.getCheckMp(StrNum).booleanValue())) {
/*  976 */               ResponseUtils.setErrorMsgResponse("手机号码不合法", 
/*  977 */                 response);
/*  978 */               return;
/*      */             }
/*      */           }
/*      */         }
/*  982 */         nResult = this.dao.applyUpdates(p);
/*      */       }
/*      */ 
/*  985 */       ParserDataSetJson pMember = 
/*  986 */         ParserDataSetJson.fromString(RequestUtils.getString(request, "member"));
/*  987 */       if (pMember == null) {
/*  988 */         ++nResult;
/*      */       }
/*  990 */       else if (pMember.isExistsUpdateRows()) {
/*  991 */         for (int i = 0; i < pMember.getListUpdateRows().size(); ++i) {
/*  992 */           GsonHeadOneRow r = (GsonHeadOneRow)pMember.getListUpdateRows().get(i);
/*  993 */           Long id = ObjectComm.objectToLong(r
/*  994 */             .getValueOfName("id"));
/*  995 */           if (id == null) {
/*  996 */             DbConnection.rollback();
/*  997 */             ResponseUtils.setErrorMsgResponse("Id为空", response);
/*  998 */             return;
/*      */           }
/* 1000 */           if (this.memberDao.getOldMemberStatus(id).intValue() > 0) {
/* 1001 */             String cardNo = (String)r
/* 1002 */               .getValueOfName("MemberCardNo");
/* 1003 */             if (StringUtils.isEmpty(cardNo)) {
/* 1004 */               cardNo = ShopMap.getCardFlagOfShopId(shopId) + 
/* 1005 */                 this.memberDao.getMaxMemberNo();
/* 1006 */               r.autoAddHeadData("MemberCardNo", cardNo);
/*      */             } else {
/* 1008 */               int count = this.shopMemberDAO.getCardNoIsExsit(
/* 1009 */                 cardNo, shopId);
/* 1010 */               if (count >= 1) {
/* 1011 */                 DbConnection.rollback();
/* 1012 */                 ResponseUtils.setErrorMsgResponse(
/* 1013 */                   "已有相同的会员卡号", response);
/* 1014 */                 return;
/*      */               }
/* 1016 */               r.autoInsertHeadData("MemberCardNo", cardNo);
/*      */             }
/* 1018 */             Long outMId = this.memberDao.getOutMIdOfId(id);
/* 1019 */             nResult = this.shopMemberDAO.updateCardNo(id, shopId, 
/* 1020 */               cardNo).intValue();
/*      */ 
/* 1021 */             if ((outSId != null) && (outSId.longValue() > 0L) && 
/* 1022 */               (outMId != null) && (outMId.longValue() > 0L) && 
/* 1023 */               (nResult > 0)) {
/* 1024 */               getPtMemberStatusLost(r.objectToJsonStr(), 
/* 1025 */                 outMId, outSId, response);
/*      */             }
/* 1027 */             if (nResult > 0) {
/* 1028 */               nResult += this.memberDao.applyUpdates(pMember);
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/* 1037 */       if (nResult > 0)
/* 1038 */         DbConnection.commit();
/*      */       else {
/* 1040 */         DbConnection.rollback();
/*      */       }
/* 1042 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 1043 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/* 1044 */         response);
/*      */     } catch (Exception e) {
/* 1046 */       DbConnection.rollback();
/* 1047 */       logger.error(e);
/* 1048 */       ResponseUtils.setErrorMsgResponse(
/* 1049 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 1050 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   private int getGsonOfLevelid(int nResult, String custName, String openId, String mp, Long shopId, HttpServletRequest request, HttpServletResponse response)
/*      */     throws SQLException
/*      */   {
/* 1058 */     Long memberId = null;
/* 1059 */     Long custId = null;
/* 1060 */     Integer intAmt = Integer.valueOf(0);
/* 1061 */     Double discount = Double.valueOf(0.0D);
/* 1062 */     GsonHeadOneRow rowMemberLevel = null;
/* 1063 */     Long levelId = this.memberWxDao.selectSqlOfDefaultParamsShop(shopId, 0);
/* 1064 */     Date crTime = new Date();
/* 1065 */     if (levelId != null) {
/* 1066 */       rowMemberLevel = this.memberLeveldao.getGsonOfLevelId(levelId);
/*      */     }
/* 1068 */     if ((levelId != null) && (rowMemberLevel != null) && 
/* 1069 */       (rowMemberLevel.isExistsData())) {
/* 1070 */       custId = this.custDao.getUserIdOfMp(mp);
/*      */       GsonHeadOneRow s;
/*      */       GsonHeadOneRow a;
/* 1071 */       if ((shopId.longValue() > 0L) && (custId.longValue() <= 0L)) {
/* 1072 */         String imageUrl = null;
/*      */         try
/*      */         {
/* 1075 */           CustomerInfo c = WxMapUtils.getCustInfoOfOpenId(openId);
/* 1076 */           if (c != null)
/* 1077 */             imageUrl = c.getHeadimgurl();
/*      */         }
/*      */         catch (Exception localException)
/*      */         {
/*      */         }
/* 1082 */         GsonHeadOneRow rowCustomer = new GsonHeadOneRow(new String[] { 
/* 1083 */           "name", "Mp", "openId", "password", 
/* 1084 */           "Status", 
/* 1085 */           "createTime", "CustFrom", "wxCreateTime", "imageUrl" }, 
/* 1086 */           new Object[] { custName, 
/* 1087 */           mp, openId, 
/* 1088 */           "111111", Integer.valueOf(0), crTime, Integer.valueOf(3), crTime, imageUrl });
/* 1089 */         nResult = this.custDao.insertGsonHeadOneRow(rowCustomer);
/* 1090 */         if (nResult > 0) {
/* 1091 */           custId = this.custDao.getLastId();
/* 1092 */           if (custId.longValue() > 0L) {
/* 1093 */             s = new GsonHeadOneRow(new String[] { 
/* 1094 */               "custId", "shopId" }, new Object[] { custId, 
/* 1095 */               shopId });
/* 1096 */             nResult = this.custShopDao.insertGsonHeadOneRow(s);
/*      */           }
/*      */ 
/* 1099 */           if ((custId.longValue() > 0L) && (nResult > 0)) {
/* 1100 */             String[] headMember = { "CustID", 
/* 1101 */               "status", "CreateFileTime", "payPwd", 
/* 1102 */               "LevelID", "DepositAmount", "IntegralAmount", 
/* 1103 */               "ConsumeAmount", "CashCouponAmount", 
/* 1104 */               "CouponAmount" };
/* 1105 */             Object[] dataMember = { custId, 
/* 1106 */               Integer.valueOf(2), crTime, "111111", 
/* 1107 */               levelId, Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0) };
/* 1108 */             GsonHeadOneRow gMember = new GsonHeadOneRow(headMember, 
/* 1109 */               dataMember);
/* 1110 */             gMember.encryptHead("payPwd");
/* 1111 */             Integer validDay = null;
/* 1112 */             if ((levelId != null) && (levelId.longValue() > 0L)) {
/* 1113 */               validDay = ObjectComm.objectToInteger(rowMemberLevel.getValueOfName("ValidDay"));
/* 1114 */               if (validDay.intValue() <= 0)
/* 1115 */                 gMember.autoAddHeadData("ValidDateTime", 
/* 1116 */                   CDateTimeComm.getAddYear(crTime, 
/* 1117 */                   100));
/*      */               else {
/* 1119 */                 gMember.autoAddHeadData("ValidDateTime", 
/* 1120 */                   CDateTimeComm.getAddDay(crTime, 
/* 1121 */                   validDay.intValue()));
/*      */               }
/* 1123 */               discount = ObjectComm.objectToDouble(rowMemberLevel.getValueOfName("discount"));
/* 1124 */               gMember.autoAddHeadData("ValidDay", validDay);
/* 1125 */               gMember.autoAddHeadData("DisCount", discount);
/*      */             }
/* 1127 */             nResult = this.memberDao.insertGsonHeadOneRow(gMember);
/* 1128 */             if (nResult > 0) {
/* 1129 */               memberId = this.memberDao.getLastId();
/* 1130 */               GsonHeadOneRow memberRuleRow = this.memberIntegralRuleDAO.getGsonOneRowOfNameAndMemberIdAndCus("会员注册");
/* 1131 */               if (memberRuleRow != null) {
/* 1132 */                 intAmt = ObjectComm.objectToInteger(memberRuleRow.getValueOfName("FixedIntegral"));
/* 1133 */                 if (intAmt.intValue() > 0) {
/* 1134 */                   Long ruId = (Long)memberRuleRow.getValueOfName("RuleID");
/* 1135 */                   String billNo = this.memberIntegralBillDao.getMaxBillNo(shopId);
/* 1136 */                   nResult = this.memberIntegralBillDao.insertIntegralBill(memberId, shopId, billNo, ruId, intAmt, "会员注册", crTime, null, 1, "wx", "会员注册");
/* 1137 */                   if (nResult > 0) {
/* 1138 */                     Long billId = this.memberIntegralBillDao.getLastId();
/* 1139 */                     nResult = this.integralDetailDAO.insertBusBillDtialInAmt(memberId, 
/* 1140 */                       shopId, intAmt, Integer.valueOf(0), billId);
/*      */                   }
/*      */                 } else {
/* 1143 */                   logger.info("无可添加的积分");
/*      */                 }
/*      */               }
/*      */ 
/* 1147 */               if ((nResult > 0) && (memberId.longValue() > 0L)) {
/* 1148 */                 Long groupId = 
/* 1149 */                   ShopMap.getGroupIdOfShopId(shopId);
/* 1150 */                 gMember.delHead(new String[] { "CustID" });
/* 1151 */                 gMember.addHeadData(new String[] { "MemberID", 
/* 1152 */                   "ShopID", "groupId", "MemberCardNo", 
/* 1153 */                   "IsCreateShop" }, new Object[] { 
/* 1154 */                   memberId, shopId, groupId, mp, Integer.valueOf(1) });
/* 1155 */                 if (intAmt.intValue() > 0) {
/* 1156 */                   gMember.autoAddHeadData("IntegralAmount", intAmt);
/*      */                 }
/* 1158 */                 nResult = this.shopMemberDAO.insertGsonHeadOneRow(
/* 1159 */                   gMember, "crm_shop_member");
/*      */               }
/*      */ 
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*      */         }
/*      */ 
/* 1170 */         if (nResult > 0) {
/* 1171 */           a = new GsonHeadOneRow(new String[] { 
/* 1172 */             "ShopID", "OpenID", "custName", "Mp", "Status", 
/* 1173 */             "CreateFileTime" }, new Object[] { shopId, openId, 
/* 1174 */             custName, mp, Integer.valueOf(1), crTime });
/* 1175 */           nResult = this.memberWxDao.insertGsonHeadOneRow(a, "crm_memberapply");
/*      */         }
/* 1177 */       } else if ((shopId.longValue() > 0L) && (custId.longValue() > 0L)) {
/* 1178 */         String[] heads = { "wxCreateTime", "CustFrom", 
/* 1179 */           "openId" };
/* 1180 */         Object[] datas = { crTime, Integer.valueOf(3), openId };
/* 1181 */         nResult = this.custDao.updateJsonOneRow(
/* 1182 */           new GsonHeadOneRow(heads, 
/* 1182 */           datas), custId);
/* 1183 */         if (nResult > 0) {
/* 1184 */           if (this.custShopDao.exitsShopCust(custId, shopId).intValue() == 0) {
/* 1185 */             a = new GsonHeadOneRow(new String[] { 
/* 1186 */               "custId", "shopId" }, new Object[] { custId, 
/* 1187 */               shopId });
/* 1188 */             nResult = this.custShopDao.insertGsonHeadOneRow(a, 
/* 1189 */               "crm_shop_customer");
/*      */           }
/* 1191 */           memberId = this.memberDao.selectMemberIdOfCustId(custId);
/* 1192 */           if ((memberId.longValue() > 0L) && 
/* 1194 */             (!(this.shopMemberDAO.existsShopMemberOfId(memberId, 
/* 1194 */             shopId)))) {
/* 1195 */             GsonHeadOneRow memberRuleRow = this.memberIntegralRuleDAO.selectgzInfo(shopId, levelId, "会员注册");
/* 1196 */             if (memberRuleRow != null) {
/* 1197 */               intAmt = ObjectComm.objectToInteger(memberRuleRow.getValueOfName("FixedIntegral"));
/* 1198 */               if (intAmt.intValue() > 0) {
/* 1199 */                 Long ruId = (Long)memberRuleRow.getValueOfName("RuleID");
/* 1200 */                 String billNo = this.memberIntegralBillDao.getMaxBillNo(shopId);
/* 1201 */                 nResult = this.memberIntegralBillDao.insertIntegralBill(memberId, shopId, billNo, ruId, intAmt, "已关注过客户，账会员户申请赠送", crTime, null, 1, "wx", "已关注过客户，账会员户申请赠送");
/* 1202 */                 if (nResult > 0) {
/* 1203 */                   Long billId = this.memberIntegralBillDao.getLastId();
/* 1204 */                   nResult = this.integralDetailDAO.insertBusBillDtialInAmt(memberId, 
/* 1205 */                     shopId, intAmt, Integer.valueOf(0), billId);
/*      */                 }
/*      */               } else {
/* 1208 */                 logger.info("无可添加的积分");
/*      */               }
/*      */             }
/*      */ 
/* 1212 */             Integer validDay = null;
/* 1213 */             Date validDateTime = null;
/* 1214 */             if ((levelId != null) && (levelId.longValue() > 0L)) {
/* 1215 */               validDay = ObjectComm.objectToInteger(rowMemberLevel.getValueOfName("ValidDay"));
/* 1216 */               if (validDay.intValue() <= 0)
/* 1217 */                 validDateTime = CDateTimeComm.getAddYear(
/* 1218 */                   crTime, 100);
/*      */               else {
/* 1220 */                 validDateTime = CDateTimeComm.getAddDay(
/* 1221 */                   crTime, validDay.intValue());
/*      */               }
/* 1223 */               discount = ObjectComm.objectToDouble(rowMemberLevel.getValueOfName("discount"));
/*      */             }
/*      */ 
/* 1229 */             Long groupId = ShopMap.getGroupIdOfShopId(shopId);
/* 1230 */             String[] headMember = { "LevelID", 
/* 1231 */               "DepositAmount", "IntegralAmount", 
/* 1232 */               "ConsumeAmount", "CashCouponAmount", 
/* 1233 */               "CouponAmount", "MemberID", "ShopID", 
/* 1234 */               "groupId", "MemberCardNo", "ValidDay", 
/* 1235 */               "DisCount", "ValidDateTime", 
/* 1236 */               "IsCreateShop", "payPwd", "status", "CreateFileTime" };
/* 1237 */             Object[] dataMember = { levelId, Integer.valueOf(0), intAmt, 
/* 1238 */               Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), memberId, shopId, groupId, mp, 
/* 1239 */               validDay, discount, validDateTime, Integer.valueOf(1), 
/* 1240 */               "111111", Integer.valueOf(2), crTime };
/* 1241 */             GsonHeadOneRow gMember = new GsonHeadOneRow(
/* 1242 */               headMember, dataMember);
/* 1243 */             gMember.encryptHead("payPwd");
/* 1244 */             nResult = this.shopMemberDAO.insertGsonHeadOneRow(
/* 1245 */               gMember, "crm_shop_member");
/*      */           }
/*      */ 
/*      */         }
/*      */ 
/* 1254 */         if (nResult > 0) {
/* 1255 */           a = new GsonHeadOneRow(new String[] { 
/* 1256 */             "ShopID", "OpenID", "custName", "Mp", "Status", 
/* 1257 */             "CreateFileTime" }, new Object[] { shopId, openId, 
/* 1258 */             custName, mp, Integer.valueOf(1), crTime });
/* 1259 */           nResult = this.memberWxDao.insertGsonHeadOneRow(a, "crm_memberapply");
/*      */         }
/*      */       }
/*      */     }
/* 1263 */     return nResult;
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"edit/shopId/{shopId}/outOff/{memberId}/{dAmt}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void updateOutOff(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("dAmt") Double dAmt, @PathVariable("memberId") Long memberId)
/*      */   {
/*      */     try
/*      */     {
/* 1283 */       int nResult = 0;
/* 1284 */       Integer status = Integer.valueOf(7);
/* 1285 */       Long custId = null;
/* 1286 */       String custName = null;
/* 1287 */       Long outSId = ShopMap.getOutIdOfShopId(shopId);
/* 1288 */       Long userId = UserSessionInfo.getIntUserIdOfRequest(request);
/* 1289 */       String userName = UserSessionInfo.getUserNameOfRequest(request);
/* 1290 */       ParserDataSetJson p = new ParserDataSetJson(
/* 1291 */         request.getParameter("data"));
/* 1292 */       if ((p != null) && 
/* 1293 */         (p.isExistsUpdateRows())) {
/* 1294 */         GsonHeadOneRow r = (GsonHeadOneRow)p.getListUpdateRows().get(0);
/* 1295 */         custId = ObjectComm.objectToLong(r.getValueOfName("id"));
/* 1296 */         custName = this.dao.getCustNameOfId(custId);
/* 1297 */         if (custId == null) {
/* 1298 */           ResponseUtils.setErrorMsgResponse("custId为空", response);
/* 1299 */           return;
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/* 1304 */       ParserDataSetJson pMember = 
/* 1305 */         ParserDataSetJson.fromString(RequestUtils.getString(request, "member"));
/* 1306 */       if (pMember == null) {
/* 1307 */         GsonHeadOneRow r = new GsonHeadOneRow(new String[] { "status", 
/* 1308 */           "id" }, new Object[] { Integer.valueOf(7), memberId });
/* 1309 */         Long outMId = this.memberDao.getOutMIdOfId(memberId);
/* 1310 */         if (dAmt.doubleValue() > 0.0D)
/*      */         {
/* 1312 */           Map params = new HashMap();
/* 1313 */           MapUtils.addToMap(params, "amount", Integer.valueOf(0));
/* 1314 */           MapUtils.addToMap(params, "memberId", memberId);
/* 1315 */           MapUtils.addToMap(params, "shopId", shopId);
/* 1316 */           nResult = this.shopMemberDAO.update_DopositAmountInc(params);
/*      */ 
/* 1318 */           String billNo = this.bussBillDao.getMaxBillNo(shopId);
/* 1319 */           if (nResult > 0) {
/* 1320 */             String[] head = { "stID", "shopId", 
/* 1321 */               "MemberID", "BillNo", "STATUS", "CustId", 
/* 1322 */               "CustName", "ReceId", "ReceName", "ReceDate", 
/* 1323 */               "CreateTime", "BillAmt", "ReceAmt", "FactAmt", 
/* 1324 */               "PayCash", "createUId", "createUName", 
/* 1325 */               "BillPaid" };
/* 1326 */             Double disposit = Double.valueOf(0.0D - dAmt.doubleValue());
/* 1327 */             Object[] data = { Integer.valueOf(30), 
/* 1328 */               shopId, memberId, billNo, Integer.valueOf(0), custId, custName, 
/* 1329 */               userId, userName, new Date(), new Date(), 
/* 1330 */               disposit, disposit, disposit, disposit, userId, 
/* 1331 */               userName, Integer.valueOf(1) };
/* 1332 */             nResult = this.bussBillDao
/* 1333 */               .insertGsonHeadOneRow(new GsonHeadOneRow(head, 
/* 1334 */               data));
/*      */           }
/* 1336 */           if (nResult > 0) {
/* 1337 */             Long bussId = this.bussBillDao.getLastId();
/* 1338 */             String[] heads = { "MemberID", "shopId", 
/* 1339 */               "Date", "WorkNo", "ConsumeAmout", "BussID" };
/* 1340 */             Object[] datas = { memberId, shopId, 
/* 1341 */               new Date(), billNo, dAmt, bussId };
/* 1342 */             nResult = this.memberDepositConsumeRecordDAO
/* 1343 */               .insertGsonHeadOneRow(new GsonHeadOneRow(heads, 
/* 1344 */               datas));
/*      */           }
/*      */         }
/* 1347 */         if ((outSId != null) && (outSId.longValue() > 0L) && 
/* 1348 */           (outMId != null) && (outMId.longValue() > 0L)) {
/* 1349 */           updatePtOutOff(r.objectToJsonStr(), outMId, status, outSId, 
/* 1350 */             Double.valueOf(0.0D), response);
/*      */         }
/* 1352 */         nResult = this.memberDao.updateJsonOneRow(r);
/*      */ 
/* 1354 */         nResult = nResult + this.shopMemberDAO
/* 1354 */           .updateMemberStatus(status, memberId, 
/* 1354 */           shopId);
/*      */       } else {
/* 1356 */         if (pMember.isExistsUpdateRows()) {
/* 1357 */           for (int i = 0; i < pMember.getListUpdateRows().size(); ++i) {
/* 1358 */             GsonHeadOneRow r = (GsonHeadOneRow)pMember.getListUpdateRows().get(i);
/* 1359 */             r.autoAddHeadData("status", Integer.valueOf(7));
/*      */ 
/* 1362 */             memberId = ObjectComm.objectToLong(r
/* 1363 */               .getValueOfName("id"));
/* 1364 */             if (memberId == null) {
/* 1365 */               ResponseUtils.setErrorMsgResponse("Id为空", response);
/* 1366 */               return;
/*      */             }
/* 1368 */             Long outMId = this.memberDao.getOutMIdOfId(memberId);
/* 1369 */             if (dAmt.doubleValue() > 0.0D)
/*      */             {
/* 1371 */               Map params = new HashMap();
/* 1372 */               MapUtils.addToMap(params, "amount", Integer.valueOf(0));
/* 1373 */               MapUtils.addToMap(params, "memberId", memberId);
/* 1374 */               MapUtils.addToMap(params, "shopId", shopId);
/* 1375 */               nResult = this.shopMemberDAO
/* 1376 */                 .update_DopositAmountInc(params);
/*      */ 
/* 1378 */               String billNo = this.bussBillDao.getMaxBillNo(shopId);
/* 1379 */               if (nResult > 0) {
/* 1380 */                 String[] head = { "stID", 
/* 1381 */                   "shopId", "MemberID", "BillNo", 
/* 1382 */                   "STATUS", "CustId", "CustName", 
/* 1383 */                   "ReceId", "ReceName", "ReceDate", 
/* 1384 */                   "CreateTime", "BillAmt", "ReceAmt", 
/* 1385 */                   "FactAmt", "PayCash", "createUId", 
/* 1386 */                   "createUName", "BillPaid" };
/* 1387 */                 Double disposit = Double.valueOf(0.0D - dAmt.doubleValue());
/* 1388 */                 Object[] data = { 
/* 1389 */                   Integer.valueOf(30), shopId, memberId, 
/* 1390 */                   billNo, Integer.valueOf(0), custId, custName, userId, 
/* 1391 */                   userName, new Date(), new Date(), 
/* 1392 */                   disposit, disposit, disposit, disposit, 
/* 1393 */                   userId, userName, Integer.valueOf(1) };
/* 1394 */                 nResult = this.bussBillDao
/* 1395 */                   .insertGsonHeadOneRow(new GsonHeadOneRow(
/* 1396 */                   head, data));
/*      */               }
/* 1398 */               if (nResult > 0) {
/* 1399 */                 Long bussId = this.bussBillDao.getLastId();
/* 1400 */                 String[] heads = { "MemberID", 
/* 1401 */                   "shopId", "Date", "WorkNo", 
/* 1402 */                   "ConsumeAmout", "BussID" };
/* 1403 */                 Object[] datas = { memberId, 
/* 1404 */                   shopId, new Date(), billNo, dAmt, 
/* 1405 */                   bussId };
/* 1406 */                 nResult = this.memberDepositConsumeRecordDAO
/* 1407 */                   .insertGsonHeadOneRow(new GsonHeadOneRow(
/* 1408 */                   heads, datas));
/*      */               }
/*      */             }
/* 1411 */             if ((outSId == null) || (outSId.longValue() <= 0L) || 
/* 1412 */               (outMId == null) || (outMId.longValue() <= 0L) || 
/* 1413 */               (nResult <= 0)) continue;
/* 1414 */             updatePtOutOff(r.objectToJsonStr(), outMId, status, 
/* 1415 */               outSId, Double.valueOf(0.0D), response);
/*      */           }
/*      */ 
/*      */         }
/*      */ 
/* 1420 */         nResult = this.memberDao.applyUpdates(pMember);
/*      */ 
/* 1422 */         nResult = nResult + this.shopMemberDAO
/* 1422 */           .updateMemberStatus(status, memberId, 
/* 1422 */           shopId);
/*      */       }
/*      */ 
/* 1425 */       if (nResult > 0)
/* 1426 */         DbConnection.commit();
/*      */       else {
/* 1428 */         DbConnection.rollback();
/*      */       }
/* 1430 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 1431 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/* 1432 */         response);
/*      */     } catch (Exception e) {
/* 1434 */       DbConnection.rollback();
/* 1435 */       logger.error(e);
/* 1436 */       ResponseUtils.setErrorMsgResponse(
/* 1437 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 1438 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"edit/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void editList(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*      */   {
/*      */     try
/*      */     {
/* 1454 */       int nResult = 0;
/* 1455 */       Integer status = null;
/* 1456 */       Long outSId = ShopMap.getOutIdOfShopId(shopId);
/* 1457 */       ParserDataSetJson p = new ParserDataSetJson(
/* 1458 */         request.getParameter("data"));
/* 1459 */       if (p != null) {
/* 1460 */         if (p.isExistsUpdateRows()) {
/* 1461 */           GsonHeadOneRow r = (GsonHeadOneRow)p.getListUpdateRows().get(0);
/* 1462 */           Long id = ObjectComm.objectToLong(r.getValueOfName("id"));
/* 1463 */           if (id == null) {
/* 1464 */             DbConnection.rollback();
/* 1465 */             ResponseUtils.setErrorMsgResponse("Id为空", response);
/* 1466 */             return;
/*      */           }
/* 1468 */           String mp = (String)r.getValueOfName("Mp");
/* 1469 */           if (mp != null) {
/* 1470 */             Long count = this.dao.getUserIdOfMp(mp);
/* 1471 */             if (count.longValue() > 0L) {
/* 1472 */               ResponseUtils.setErrorMsgResponse("手机号码为" + mp + 
/* 1473 */                 "的客户已存在", response);
/* 1474 */               return;
/*      */             }
/* 1476 */             String StrNum = StringUtils.substring(mp, 0, 7);
/* 1477 */             if (!(this.mpCityDAO.getCheckMp(StrNum).booleanValue())) {
/* 1478 */               ResponseUtils.setErrorMsgResponse("手机号码不合法", 
/* 1479 */                 response);
/* 1480 */               return;
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*      */         }
/*      */ 
/* 1490 */         nResult = this.dao.applyUpdates(p);
/*      */       }
/*      */ 
/* 1493 */       ParserDataSetJson pMember = 
/* 1494 */         ParserDataSetJson.fromString(RequestUtils.getString(request, "member"));
/* 1495 */       if (pMember != null) {
/* 1496 */         if (pMember.isExistsUpdateRows()) {
/* 1497 */           for (int i = 0; i < pMember.getListUpdateRows().size(); ++i) {
/* 1498 */             GsonHeadOneRow r = (GsonHeadOneRow)pMember.getListUpdateRows().get(i);
/* 1499 */             status = ObjectComm.objectToInteger(r
/* 1500 */               .getValueOfName("Status"));
/* 1501 */             Long id = ObjectComm.objectToLong(r
/* 1502 */               .getValueOfName("id"));
/* 1503 */             if (id == null) {
/* 1504 */               DbConnection.rollback();
/* 1505 */               ResponseUtils.setErrorMsgResponse("Id为空", response);
/* 1506 */               return;
/*      */             }
/* 1508 */             Long outMId = this.memberDao.getOutMIdOfId(id);
/* 1509 */             if ((status != null) && (status.intValue() == 7)) {
/* 1510 */               double money = this.shopMemberDAO.getIsMoneyToNull(id, 
/* 1511 */                 shopId);
/* 1512 */               if (money > 0.0D) {
/* 1513 */                 DbConnection.rollback();
/* 1514 */                 ResponseUtils.setErrorMsgResponse("客户还有" + 
/* 1515 */                   money + "预款,不能退卡", response);
/* 1516 */                 return;
/*      */               }
/* 1518 */               if ((outSId == null) || (outSId.longValue() <= 0L) || 
/* 1519 */                 (outMId == null) || (outMId.longValue() <= 0L)) continue;
/* 1520 */               getPtMemberStatus(r.objectToJsonStr(), outMId, 
/* 1521 */                 status, outSId, response);
/*      */             }
/* 1546 */             else if (status != null) {
/* 1547 */               if ((outSId == null) || (outSId.longValue() <= 0L) || 
/* 1548 */                 (outMId == null) || (outMId.longValue() <= 0L)) continue;
/* 1549 */               getPtMemberStatus(r.objectToJsonStr(), 
/* 1550 */                 outMId, status, outSId, response);
/*      */             }
/*      */             else {
/* 1553 */               Long levelId = ObjectComm.objectToLong(r
/* 1554 */                 .getValueOfName("LevelID"));
/* 1555 */               String memberCardNo = (String)r
/* 1556 */                 .getValueOfName("MemberCardNo");
/* 1557 */               if ((memberCardNo != null) || (
/* 1558 */                 (levelId != null) && (levelId.longValue() > 0L))) {
/* 1559 */                 String[] heads = { "ShopID", 
/* 1560 */                   "MemberID" };
/* 1561 */                 Object[] datas = { shopId, id };
/* 1562 */                 GsonHeadOneRow g = new GsonHeadOneRow(
/* 1563 */                   heads, datas);
/* 1564 */                 if ((levelId != null) && (levelId.longValue() > 0L)) {
/* 1565 */                   g.autoInsertHeadData("LevelID", levelId);
/* 1566 */                   Double discount = 
/* 1567 */                     ObjectComm.objectToDouble(r
/* 1568 */                     .getValueOfName("discount"));
/* 1569 */                   if (discount != null) {
/* 1570 */                     g.autoInsertHeadData("Discount", 
/* 1571 */                       discount);
/*      */                   }
/* 1573 */                   Integer validDay = 
/* 1574 */                     Integer.valueOf(this.memberLeveldao
/* 1574 */                     .getValidDay(shopId, levelId));
/* 1575 */                   if (validDay.intValue() <= 0) {
/* 1576 */                     r.autoInsertHeadData(
/* 1577 */                       "ValidDateTime", 
/* 1578 */                       CDateTimeComm.getAddYear(
/* 1579 */                       new Date(), 100));
/* 1580 */                     g.autoInsertHeadData(
/* 1581 */                       "ValidDateTime", 
/* 1582 */                       CDateTimeComm.getAddYear(
/* 1583 */                       new Date(), 100));
/*      */                   } else {
/* 1585 */                     r.autoInsertHeadData(
/* 1586 */                       "ValidDateTime", 
/* 1587 */                       CDateTimeComm.getAddDate(
/* 1588 */                       new Date(), 
/* 1589 */                       validDay.intValue()));
/* 1590 */                     g.autoInsertHeadData(
/* 1591 */                       "ValidDateTime", 
/* 1592 */                       CDateTimeComm.getAddDate(
/* 1593 */                       new Date(), 
/* 1594 */                       validDay.intValue()));
/*      */                   }
/* 1596 */                   g.autoInsertHeadData("ValidDay", 
/* 1597 */                     validDay);
/* 1598 */                   r.autoInsertHeadData("ValidDay", 
/* 1599 */                     validDay);
/*      */                 }
/*      */ 
/* 1602 */                 if (StringUtils.isEmpty(
/* 1602 */                   StringUtils.trim(memberCardNo))) {
/* 1603 */                   memberCardNo = 
/* 1604 */                     ShopMap.getCardFlagOfShopId(shopId) + 
/* 1605 */                     this.memberDao.getMaxMemberNo();
/* 1606 */                   g.autoInsertHeadData("MemberCardNo", 
/* 1607 */                     memberCardNo);
/* 1608 */                   r.autoInsertHeadData("MemberCardNo", 
/* 1609 */                     memberCardNo);
/*      */                 } else {
/* 1611 */                   int count = this.shopMemberDAO
/* 1612 */                     .getCardNoIsExsit(memberCardNo, 
/* 1613 */                     shopId);
/* 1614 */                   if (count >= 1) {
/* 1615 */                     DbConnection.rollback();
/* 1616 */                     ResponseUtils.setErrorMsgResponse(
/* 1617 */                       "已有相同的会员卡号", response);
/* 1618 */                     return;
/*      */                   }
/* 1620 */                   g.autoInsertHeadData("MemberCardNo", 
/* 1621 */                     memberCardNo);
/*      */                 }
/* 1623 */                 int nslt = this.shopMemberDAO
/* 1624 */                   .updateJsonHeadOneRow(g, 
/* 1625 */                   "crm_shop_member");
/* 1626 */                 if (nslt <= 0) {
/* 1627 */                   DbConnection.rollback();
/* 1628 */                   ResponseUtils.setErrorMsgResponse(
/* 1629 */                     "会员主要信息修改失败", response);
/* 1630 */                   return;
/*      */                 }
/* 1632 */                 ++nResult;
/*      */               }
/*      */ 
/* 1635 */               if ((outSId != null) && (outSId.longValue() > 0L) && 
/* 1636 */                 (outMId != null) && (outMId.longValue() > 0L)) {
/* 1637 */                 getPtMemberEdit(r.objectToJsonStr(), 
/* 1638 */                   outMId, status, outSId, response);
/*      */               }
/* 1640 */               r.encryptHead("payPwd");
/* 1641 */               r.delHead("discount");
/*      */             }
/*      */           }
/*      */         }
/*      */ 
/* 1646 */         nResult += this.memberDao.applyUpdates(pMember);
/*      */       }
/*      */ 
/* 1649 */       if (nResult > 0)
/* 1650 */         DbConnection.commit();
/*      */       else {
/* 1652 */         DbConnection.rollback();
/*      */       }
/* 1654 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 1655 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/* 1656 */         response);
/*      */     } catch (Exception e) {
/* 1658 */       DbConnection.rollback();
/* 1659 */       logger.error(e);
/* 1660 */       ResponseUtils.setErrorMsgResponse(
/* 1661 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 1662 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   private GsonEbRst getPtMemberStatusLost(String objectToJsonStr, Long id, Long shopId, HttpServletResponse response)
/*      */     throws IOException
/*      */   {
/* 1689 */     String sData = null;
/* 1690 */     GsonHeadOneRow gs = GsonHeadOneRow.jsonStrToObject(objectToJsonStr);
/*      */ 
/* 1692 */     gs.delHead("id");
/*      */ 
/* 1702 */     sData = "data=" + gs.objectToJsonStr() + "&" + 
/* 1703 */       "id" + "=" + id.toString() + "&shopId=" + shopId;
/*      */ 
/* 1705 */     GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst("ptmember/edit", 
/* 1706 */       sData, response);
/* 1707 */     if (rst != null) {
/* 1708 */       return rst;
/*      */     }
/* 1710 */     return null;
/*      */   }
/*      */ 
/*      */   private GsonEbRst getPtMemberStatus(String objectToJsonStr, Long id, Integer status, Long shopId, HttpServletResponse response)
/*      */     throws IOException
/*      */   {
/* 1717 */     String sData = null;
/* 1718 */     GsonHeadOneRow gs = GsonHeadOneRow.jsonStrToObject(objectToJsonStr);
/* 1719 */     String state = MemberState.getState(status);
/* 1720 */     gs.delHead("id");
/* 1721 */     gs.autoAddHeadData("status", state);
/*      */ 
/* 1730 */     sData = "data=" + gs.objectToJsonStr() + "&" + 
/* 1731 */       "id" + "=" + id.toString() + "&shopId=" + shopId;
/*      */ 
/* 1733 */     GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(
/* 1734 */       "ptmember/editStatus", sData, response);
/* 1735 */     if (rst != null) {
/* 1736 */       return rst;
/*      */     }
/* 1738 */     return null;
/*      */   }
/*      */ 
/*      */   private GsonEbRst updatePtOutOff(String objectToJsonStr, Long id, Integer status, Long shopId, Double dAmt, HttpServletResponse response)
/*      */     throws IOException
/*      */   {
/* 1745 */     String sData = null;
/* 1746 */     GsonHeadOneRow gs = GsonHeadOneRow.jsonStrToObject(objectToJsonStr);
/* 1747 */     String state = MemberState.getState(status);
/* 1748 */     gs.delHead("id");
/* 1749 */     gs.autoAddHeadData("status", state);
/* 1750 */     sData = "data=" + gs.objectToJsonStr() + "&" + 
/* 1751 */       "id" + "=" + id.toString() + "&shopId=" + shopId + 
/* 1752 */       "&dAmt=" + dAmt;
/* 1753 */     GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(
/* 1754 */       "ptmember/edit/outOff", sData, response);
/* 1755 */     if (rst != null) {
/* 1756 */       return rst;
/*      */     }
/* 1758 */     return null;
/*      */   }
/*      */ 
/*      */   private GsonEbRst getPtMemberEdit(String objectToJsonStr, Long id, Integer status, Long shopId, HttpServletResponse response)
/*      */     throws IOException
/*      */   {
/* 1765 */     GsonHeadOneRow gs = GsonHeadOneRow.jsonStrToObject(objectToJsonStr);
/* 1766 */     String[] delHead = { "OperatorID", "MemberMemo", "SaleId", 
/* 1767 */       "MemberFee", "Modified", "payPwd", "id" };
/* 1768 */     gs.delHead(delHead);
/* 1769 */     GsonEbRst rst = null;
/* 1770 */     if (gs.getDataLength() > 0) {
/* 1771 */       String sData = "data=" + gs.objectToJsonStr() + "&" + 
/* 1772 */         "id" + "=" + id.toString() + "&shopId=" + 
/* 1773 */         shopId;
/* 1774 */       rst = HttpGsonPtResponseUtils.postPtEbRst("ptmember/edit", sData, 
/* 1775 */         response);
/*      */     }
/* 1777 */     if (rst != null) {
/* 1778 */       return rst;
/*      */     }
/* 1780 */     return null;
/*      */   }
/*      */ 
/*      */   private Long getMemberIdPtLong(String sGsonInData, String gsData, Long groupId, Long outId, Double discount, HttpServletResponse response)
/*      */     throws Exception
/*      */   {
/* 1788 */     GsonHeadOneRow gs = GsonHeadOneRow.jsonStrToObject(sGsonInData);
/* 1789 */     GsonEbRstLong rst = null;
/* 1790 */     if (gs != null) {
/* 1791 */       logger.debug("gs info beg");
/* 1792 */       String[] delHead = { "OperatorID", "MemberMemo", 
/* 1793 */         "SaleId", "MemberFee", "Modified", "payPwd", "id" };
/* 1794 */       gs.delHead(delHead);
/* 1795 */       if (gs.getDataLength() > 0) {
/* 1796 */         Integer status = (Integer)gs.getValueOfName("Status");
/* 1797 */         if (status != null) {
/* 1798 */           String nStatus = MemberState.getState(status);
/* 1799 */           gs.setValueOfName("Status", nStatus);
/*      */         }
/* 1801 */         String sSendToPt = gs.objectToJsonStr();
/* 1802 */         String sData = "data=" + sSendToPt + "&gsData=" + 
/* 1803 */           gsData + "&groupId=" + groupId + "&outId=" + outId + 
/* 1804 */           "&discount=" + discount;
/* 1805 */         String sUrl = "ptmember/insert";
/* 1806 */         rst = HttpGsonPtUtils.getEbRstLong(sUrl, sData, response);
/*      */       }
/* 1808 */       logger.debug("gs info end");
/* 1809 */       if (rst != null) {
/* 1810 */         return rst.getResult();
/*      */       }
/* 1812 */       return null;
/*      */     }
/*      */ 
/* 1816 */     ResponseUtils.setErrorMsgResponse("获取Crm信息失败", response);
/* 1817 */     return null;
/*      */   }
/*      */ 
/*      */   private int saveAfter(Long lMemberId, Integer validDay, Long shopId, Long groupId, String createFileMan, String serviceMan, Object LevelID, Date greatTime, Date validayTime, boolean bDeleteHis, String memo, String cardNo, Double discount, HttpServletResponse response)
/*      */     throws SQLException
/*      */   {
/* 1826 */     int nResult = 0;
/* 1827 */     String[] heads = { "MemberID", "ShopID", "IsCreateShop", 
/* 1828 */       "GroupId", "DepositAmount", "IntegralAmount", "ConsumeAmount", 
/* 1829 */       "CashCouponAmount", "CouponAmount", "ValidDateTime", "LevelID", 
/* 1830 */       "MemberCardNo", "ValidDay", "discount" };
/* 1831 */     Object[] datas = { lMemberId, shopId, Boolean.valueOf(true), groupId, Double.valueOf(0.0D), 
/* 1832 */       Double.valueOf(0.0D), Double.valueOf(0.0D), Double.valueOf(0.0D), Double.valueOf(0.0D), validayTime, LevelID, cardNo, validDay, 
/* 1833 */       discount };
/* 1834 */     GsonHeadOneRow g = new GsonHeadOneRow(heads, datas);
/* 1835 */     if (this.shopMemberDAO.existsShopMemberOfId(lMemberId, shopId)) {
/* 1836 */       ResponseUtils.setErrorMsgResponse("客户已是本店会员", response);
/*      */     }
/*      */     else {
/* 1839 */       nResult = this.shopMemberDAO.insertGsonHeadOneRow(g);
/*      */     }
/* 1841 */     if ((nResult > 0) && 
/* 1842 */       (this.memberServiceBillDAO.insertBill(lMemberId, createFileMan, 
/* 1843 */       serviceMan, shopId, memo).intValue() > 0))
/*      */     {
/* 1844 */       Long billId = this.memberServiceBillDAO.getLastId();
/* 1845 */       this.memberServiceBillDetailDAO.insertBillDetail(lMemberId, billId, 
/* 1846 */         LevelID, shopId);
/* 1847 */       this.memberServiceDetailDAO.insertDetail(validDay, greatTime, 
/* 1848 */         validayTime, lMemberId, shopId, LevelID, bDeleteHis);
/* 1849 */       nResult = 1;
/*      */     }
/*      */ 
/* 1852 */     return nResult;
/*      */   }
/*      */ 
/*      */   private int saveAfter2(Long lMemberId, Integer validDay, Long shopId, Long groupId, Object LevelID, Date validayTime, String cardNo, Double discount, Long outMId, HttpServletResponse response)
/*      */     throws Exception
/*      */   {
/* 1859 */     int nResult = 0;
/* 1860 */     String[] heads = { "MemberID", "ShopID", "IsCreateShop", 
/* 1861 */       "GroupId", "DepositAmount", "IntegralAmount", "ConsumeAmount", 
/* 1862 */       "CashCouponAmount", "CouponAmount", "ValidDateTime", "LevelID", 
/* 1863 */       "MemberCardNo", "ValidDay", "discount", "Status" };
/* 1864 */     Object[] datas = { lMemberId, shopId, Boolean.valueOf(true), groupId, Double.valueOf(0.0D), 
/* 1865 */       Double.valueOf(0.0D), Double.valueOf(0.0D), Double.valueOf(0.0D), Double.valueOf(0.0D), validayTime, LevelID, cardNo, validDay, 
/* 1866 */       discount, Integer.valueOf(1) };
/* 1867 */     GsonHeadOneRow g = new GsonHeadOneRow(heads, datas);
/* 1868 */     if (this.shopMemberDAO.existsShopMemberOfId(lMemberId, shopId)) {
/* 1869 */       ResponseUtils.setErrorMsgResponse("客户已是本店会员", response);
/*      */     }
/*      */     else {
/* 1872 */       nResult = this.shopMemberDAO.insertGsonHeadOneRow(g);
/* 1873 */       if ((nResult > 0) && 
/* 1874 */         (outMId != null) && (outMId.longValue() > 0L)) {
/* 1875 */         insertPtShopMember(shopId, outMId, groupId, validayTime, 
/* 1876 */           LevelID, cardNo, validDay, discount, response);
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/* 1881 */     return nResult;
/*      */   }
/*      */ 
/*      */   private Long getPtCustIdOfInsertPt(String sGsonInData, String shopId, HttpServletResponse response) throws Exception
/*      */   {
/* 1886 */     GsonHeadOneRow gs = GsonHeadOneRow.jsonStrToObject(sGsonInData);
/* 1887 */     String[] heads = { "CompName", "CompDuty", "IndusType", 
/* 1888 */       "CustFrom", "AppCust" };
/* 1889 */     gs.delHead(heads);
/* 1890 */     GsonEbRstLong rst = null;
/* 1891 */     if (gs.getDataLength() > 0) {
/* 1892 */       String sData = "data=" + gs.objectToJsonStr() + "&" + 
/* 1893 */         "shopId" + "=" + shopId;
/* 1894 */       String url = "ptcust/insert";
/* 1895 */       rst = HttpGsonPtUtils.getEbRstLong(url, sData, response);
/*      */     }
/* 1897 */     if (rst != null) {
/* 1898 */       return rst.getResult();
/*      */     }
/* 1900 */     return null;
/*      */   }
/*      */ 
/*      */   private GsonEbRst getPtCustDelEbRst(Long outId, Object shopId, HttpServletResponse response)
/*      */     throws Exception
/*      */   {
/* 1906 */     String sData = "id=" + outId.toString() + "&shopId=" + 
/* 1907 */       shopId;
/* 1908 */     GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst("ptcust/del", 
/* 1909 */       sData, response);
/* 1910 */     if (rst != null) {
/* 1911 */       return rst;
/*      */     }
/* 1913 */     return null;
/*      */   }
/*      */ 
/*      */   private GsonEbRst getPtCustCheckEbRst(Long outId, Object shopId, HttpServletResponse response)
/*      */     throws Exception
/*      */   {
/* 1919 */     String sData = "id=" + outId.toString() + "&shopId=" + 
/* 1920 */       shopId;
/* 1921 */     GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst("ptmember/check", 
/* 1922 */       sData, response);
/* 1923 */     if (rst != null) {
/* 1924 */       return rst;
/*      */     }
/* 1926 */     return null;
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"del/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void delete(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*      */   {
/* 1941 */     String id = RequestUtils.getStringOfId(request);
/*      */     try {
/* 1943 */       Long outId = this.dao.getIsOutId(id);
/* 1944 */       if (outId.longValue() > 0L) {
/* 1945 */         GsonEbRst rst = getPtCustDelEbRst(outId, shopId, response);
/* 1946 */         if ((rst == null) || (rst.getState() != 0)) {
/* 1947 */           logger.error("outId删除失败");
/*      */         }
/*      */       }
/* 1950 */       String[] strParams = id.split(",");
/* 1951 */       int nResult = this.dao.deleteParams(strParams);
/* 1952 */       if (nResult > 0) {
/* 1953 */         nResult = this.custShopDao.deleteParams(strParams);
/*      */       }
/* 1955 */       if (nResult > 0)
/* 1956 */         DbConnection.commit();
/*      */       else {
/* 1958 */         DbConnection.rollback();
/*      */       }
/* 1960 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 1961 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 1962 */         response);
/*      */     } catch (Exception e) {
/* 1964 */       DbConnection.rollback();
/* 1965 */       logger.error(e);
/* 1966 */       ResponseUtils.setErrorMsgResponse(
/* 1967 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 1968 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ 
/*      */   @Transactional
/*      */   @RequestMapping(value={"paid/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*      */   public void paid(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*      */   {
/* 1983 */     Long id = ObjectComm.stringToLong(RequestUtils.getStringOfId(request), 
/* 1984 */       Long.valueOf(0L));
/*      */     try {
/* 1986 */       Long outId = this.memberDao.getOutMIdOfId(id);
/* 1987 */       if (outId.longValue() > 0L) {
/* 1988 */         GsonEbRst rst = getPtCustCheckEbRst(outId, shopId, response);
/* 1989 */         if ((rst == null) || (rst.getState() != 0)) {
/* 1990 */           logger.error("pt审核失败");
/*      */         }
/*      */       }
/* 1993 */       Integer nResult = Integer.valueOf(this.memberDao.updateStatusOfId(Integer.valueOf(2), id));
/*      */ 
/* 1995 */       nResult = Integer.valueOf(nResult.intValue() + this.shopMemberDAO
/* 1995 */         .updateMemberStatus(Integer.valueOf(2), 
/* 1995 */         id, shopId));
/* 1996 */       if (nResult.intValue() > 0)
/* 1997 */         DbConnection.commit();
/*      */       else {
/* 1999 */         DbConnection.rollback();
/*      */       }
/*      */ 
/* 2002 */       ResponseUtils.setSqlResultResponse(nResult.intValue(), 
/* 2003 */         RequestUtils.getSqlCheckDataErrorMessage(request), 
/* 2004 */         response);
/*      */     } catch (Exception e) {
/* 2006 */       DbConnection.rollback();
/* 2007 */       logger.error(e);
/* 2008 */       ResponseUtils.setErrorMsgResponse(
/* 2009 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 2010 */         e.getMessage(), response);
/*      */     }
/*      */   }
/*      */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.custMember.controller.CustMemberController
 * JD-Core Version:    0.5.3
 */